package com.gzhryc.shared_device.oem.code.place.dao.models;

import com.gzhryc.common.StringTools;
import com.gzhryc.shared_device.oem.code.business.EBusinessType;
import com.gzhryc.shared_device.oem.code.device.EDeviceFunCode;

import java.util.ArrayList;
import java.util.List;

public class IncomeRatioContent {

    public List<Item> items;

    public IncomeRatioContent(){
        this.items = new ArrayList<>();
    }

    public List<Item> getItems() {
        return items;
    }

    public void setItems(List<Item> items) {
        this.items = items;
    }

    public static class Item {

        private String businessType;
        private Double incomeRatio;

        private String deviceFunCode;

        public String getBusinessType() {
            if(StringTools.isBlank(businessType)){
                if(EDeviceFunCode.CDB.index().equals(deviceFunCode)){
                    businessType = EBusinessType.CDB.index();
                }else if(EDeviceFunCode.BXSCN.index().equals(deviceFunCode)){
                    businessType = EBusinessType.BXSCN.index();
                }else if(EDeviceFunCode.CDCZ.index().equals(deviceFunCode)){
                    businessType = EBusinessType.CDCZ.index();
                }
            }
            return businessType;
        }

        public void setBusinessType(String businessType) {
            this.businessType = businessType;
        }

        public Double getIncomeRatio() {
            return incomeRatio;
        }

        public void setIncomeRatio(Double incomeRatio) {
            this.incomeRatio = incomeRatio;
        }
    }
}
